{extend name="web/public/base" /}
{block name="header"}
{/block}
{block name="main"}
<section class="scrollable padder">
    <ul class="breadcrumb no-border no-radius b-b b-light pull-in">
        <li><a><i class="fa fa-home"></i> 首页</a></li>
        <li class="active">财务中心</li>
        <li class="active">{$title}</li>
    </ul>
    <div class="row">
        <div class="col-sm-12">
            <section class="panel panel-default">
                <header class="panel-heading"> {$title}&nbsp;&nbsp;&nbsp;&nbsp;(提现总计:{$total|format_num};&nbsp;&nbsp;未审核总计:{$total1|format_num};&nbsp;&nbsp;拒批总计:{$total2|format_num};&nbsp;&nbsp;同意总计:{$total3|format_num})</header>
                <div style="margin-top: 10px;margin-left:15px;">
                <button type="button" class="btn btn-primary" onclick="allAuditing();">统一审批</button>
                </div>
                {include file="web/public/search" /}
                {notempty name="_list"}
                <div class="table-responsive">
                    <table class="table table-striped table-hover b-t b-light text-sm">
                        <thead>
                        <tr style="cursor:pointer;">
                            <th>申请时间</th>
                            <th>会员账号</th>
                            <!--<th>币种</th>-->
                            <th>提现金额</th>
                            <th>实得金额</th>
                            <th>手续费</th>
                            <th>支付宝收款码</th>
                            <th>微信收款码</th>
                            <th>开户银行</th>
                            <th>银行卡号</th>
                            <th>申请状态</th>
                            <th>处理时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {volist name='_list' id='vo'}
                        <tr>
                            <td>{$vo.createtime|date="Y-m-d",###}</td>
                            <td>{$vo.userid|getInfo='usernumber',###}[{$vo.realname}]</td>
                            <!--<td>{$vo.moneytype|getMoneyType}</td>-->
                            <td>{$vo['money']+$vo['fee']|format_num}</td>
                            <td>{$vo.money|format_num}</td>
                            <td>{$vo.fee|format_num}</td>
                            <td><img src="{$vo.alipay|get_cover='path'}" alt="" style="width:100px;"></td>
                            <td><img src="{$vo.wechat|get_cover='path'}" alt="" style="width:100px;"></td>
                            <td>{$vo.bankname|default='无'}</td>
                            <td>{$vo.banknumber|default='无'}</td>
                            <td>
                                {if condition="$vo.status eq 0 "}<span style="color:orange">正在审核</span>{/if}
                                {if condition="$vo.status eq 1 "}<span style="color:green">申请获批</span>{/if}
                                {if condition="$vo.status eq -1 "}<span style="color:red">申请拒批</span>{/if}
                            </td>
                            <td>
                                {if condition="$vo.status neq 0 "}{$vo.handtime|date="Y-m-d",###}{else/}正在审核{/if}
                            </td>
                            <td>
                                {if condition="$vo.status eq 0 "}
                                <a class='btn btn-mini btn-danger' href="javascript:void(0);"
                                   onclick="auditing({$vo['id']})">审批</a>
                                {/if}

                                <a class='btn btn-mini btn-info'
                                   href="{:url('withdrawal',array('id'=>$vo['id']))}">查看详情</a>
                            </td>
                        </tr>
                        {/volist}
                        </tbody>
                    </table>
                </div>
                <footer class="panel-footer">
                    <div class="row">
                        <div class="text-right text-center-xs">
                            {$page}
                        </div>
                    </div>
                </footer>
                {else/}
                <div style="text-align: center">
                    <image src="__PUBLIC__/images/empty.jpg"></image>
                </div>

                {/notempty}
            </section>
        </div>
    </div>
</section>
{/block}
{block name="script"}
<script type="text/javascript">
    function allAuditing() {
        layer.confirm('确定批准所有的提现申请吗？', {
            btn: ['批准', '拒批', '取消'],
        }, function () {
            var index = layer.load('正在跳转，请耐心等待');
            $.post("{:url('agree')}", {type: 1}, function (data) {
                layer.close(index);
                layer.msg(data.msg, function () {
                    location.reload();
                });
            }, "json");
            return false;
        }, function () {
            var index = layer.load('正在跳转，请耐心等待');
            $.post("{:url('refuse')}", {type: 1}, function (data) {
                layer.close(index);
                layer.msg(data.msg, function () {
                    location.reload();
                });
            }, "json");
            return false;
        });
    }

    function auditing(id) {
        layer.confirm('确定批准该会员的提现申请吗？', {
            btn: ['批准', '拒批', '取消'],
        }, function () {
            var index = layer.load('正在跳转，请耐心等待');
            $.post("{:url('agree')}", {type: 2, id: id}, function (data) {
                layer.close(index);
                layer.msg(data.msg, function () {
                    location.reload();
                });
            }, "json");
            return false;
        }, function () {
            var index = layer.load('正在跳转，请耐心等待');
            $.post("{:url('refuse')}", {type: 2, id: id}, function (data) {
                layer.close(index);
                layer.msg(data.msg, function () {
                    location.reload();
                });
            }, "json");
            return false;
        }, function () {
            return false;
        });
    }
</script>
{/block}
{block name="footer"}
{/block}